home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.3 / Video Toaster v4.3.iso / 3.1 / toasterall / arexx_examples / timelapse.rexx < prev    next >
OS/2 REXX Batch file  |  1993-06-06  |  2KB  |  53 lines

  1. /* TimeLapse.rexx -- Record frames at intervals of 1 to 60 mins */
  2. /* By Arnie Cachelin © 1992 NewTek Inc. */
  3.  
  4. OPTIONS RESULTS
  5. TOASTERLIB="ToasterARexx.port"
  6. REXXLIB = "rexxsupport.library"
  7.  
  8. arg delay count name
  9.  
  10. if arg()=0 then do
  11.   say "USAGE: rx TimeLapse <delay in mins> <# of frames> <name>"
  12.   exit
  13. end
  14.  
  15. if delay="" then delay = 1
  16. if delay<1 then delay = 1
  17. if delay>60 then delay = 60
  18. if count="" then count=10
  19. if count>1000 then count=1000
  20. if name="" then name=left(date(),6)
  21. delay=delay*60*30       /* delay in minutes x 60s/min x 30f/s = delay in frames */
  22.  
  23. IF ~SHOW('Libraries',TOASTERLIB) = 0 THEN
  24.   IF ~ADDLIB(TOASTERLIB , 0) THEN x=Bummer(" Please start your Video Toaster!")
  25.  
  26. Switcher(TOSW)        /* Go to Switcher screen */
  27. Switcher(LVID)        /* Set to live digital video */
  28. time(reset)
  29. do f=0 to count
  30.   Switcher(FVID)      /* Freeze frame */
  31.   SaveNextFrame(name||time(elapsed))
  32.   Switcher(LVID)      /* Set to live digital video */
  33.   Switcher(FRES)      /* Reset frame counter */
  34.   Switcher(WAIT,delay)   /* Wait */
  35. end
  36. Switcher(TOWB)        /* Go to Workbench screen */
  37.  
  38. exit
  39.  
  40. SaveNextFrame:  Procedure
  41.   arg name
  42.   N=Switcher(STAT,KNUM)       /* Get the current keypad number */
  43.   fs=N+1
  44.   do while Switcher(FMXI,fs) &fs~=N   /* Is the frame already there? */
  45.     if fs=999 then fs=0       /* wrap around at last frame */
  46.     else fs=fs+1
  47.   end
  48.   if fs=N then t=10        /* got to starting frame without finding open fs */
  49.   else t=Switcher(FMSV,fs,name)    /* Save frame */
  50.   say "Saved frame "name" in number "fs " at "time()
  51.   return t
  52.  
  53.